/*
 ============================================================================
 Name		: TradeBlock.h
 Author	  : Zhang Jiawei
 Version	 : 1.0
 Copyright   : Your copyright notice
 Description : CTradeBlock declaration
 ============================================================================
 */

#ifndef TRADEBLOCK_H
#define TRADEBLOCK_H

// INCLUDES
#include "BaseBlock.h"
#include "eStockTransactionView.h"
#include "eStockTransactionContainer.h"
#include "TradeStringLiteral.h"
#include "TradeBlockNetwork.h"

// CLASS DECLARATION

class CTradeBlock: public CBaseBlock, public MReqObserver
{
public:
    ~CTradeBlock();

    CTradeBlock(CBaseBlock* bsBack);
    
    void ConstructL();
    
public:
	TBool TipInfo(const TDesC& buf, const TDesC& aTitle);
	TBool TipInfo(TInt id, const TDesC& aTitle);
	TBool ShowNetworkMsg(char* pcstr_text);

	TBool SendNetworkPacage(__trader_package_t* pkg);
	
public:
    virtual TBool KeyPressed(const TInt& keyCode);
    
    virtual void OnKeyDown(TInt keyCode);
    
    virtual void PointReleased(const TPoint& aPt);
    
    virtual void SizeChanged();
        
public: // MReqObserver
	virtual TBool ProcessTradeNetworkMsg(TInt nError, TAny* p, const TDesC8& aBodyData);
	virtual TBool UpdateTradeNetwork(TInt nProgress);
	
	TBool CTradeBlock::GetTableElementColor(const TDesC& text, TRgb& color);
	
public: // from MTabbarObserver
    void HandleTabbarCommand(TInt aCommand);
public:    
    TBool OnCancel(TInt keyCode);
    	
protected:
	TBool ProcessNetworkErrorCode(p_trader_package_t param, char* psrc, TInt ilen, const TDesC& aTitle);
    
public:
    CeStockTransactionContainer* GetContainer() const;
    
protected:
	TBool	m_bIsRelogin;
	TInt	m_iMaxReqNum;
};

#endif // TRADEBLOCK_H
